Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed useless check #2129

Merged
merged 1 commit into from
May 18, 2023
Merged

Removed useless check #2129

merged 1 commit into from
May 18, 2023

Conversation

tkyc
Copy link
Member

@tkyc tkyc commented May 17, 2023

@Jeffery-Wasty
Copy link
Contributor

Jeffery-Wasty commented May 17, 2023

Since ticksSinceMidnight is now only used in one place, can we skip defining a variable? Does SonarQube complain about this? If this suggestion too ugly, we can keep it as you already have it:

        case DATETIME:
            if (8 != decryptedValue.length) {
                MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_NormalizationErrorAE"));
                throw new SQLServerException(form.format(new Object[] {baseSSType}), null, 0, null);
            }

            // SQL datetime is 4 bytes for days since SQL Base Date
            // (January 1, 1900 00:00:00 GMT) and 4 bytes for
            // the number of three hundredths (1/300) of a second since midnight.
            return DDC.convertTemporalToObject(jdbcType, SSType.DATETIME, cal, Util.readInt(decryptedValue, 0),
                    (Util.readInt(decryptedValue, 4) * 10L + 1) / 3, 0);

@tkyc
Copy link
Member Author

tkyc commented May 17, 2023

Looks like it passed sonarqube. I'm ok with just leaving it as is.

@lilgreenbird lilgreenbird added this to the 12.3.1 milestone May 18, 2023
@lilgreenbird lilgreenbird linked an issue May 18, 2023 that may be closed by this pull request
@tkyc tkyc merged commit 8cc5805 into main May 18, 2023
@tkyc tkyc deleted the issue#2124 branch May 18, 2023 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Faulty DATETIME ticksSinceMidnight overflow check
3 participants